<h1>Listing movies</h1>

<table>
  <tr>
    <th>Title</th>
    <th>Description</th>
    <th>Rating</th>
    <th>Released on</th>
  </tr>

<% @movies.each do |movie| %>
  <tr>
    <td><%=h movie.title %></td>
    <td><%=h movie.description %></td>
    <td><%=h movie.rating %></td>
    <td><%=h movie.released_on %></td>
		
		<% if logged_in? -%>	
			<td><%= link_to 'Show', movie %></td>
			<td><%= link_to 'Edit', edit_movie_path(movie) %></td>
			<td><%= link_to 'Destroy', movie, :confirm => 'Are you sure?', :method => :delete %></td>
		<% end -%>
		
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New movie', new_movie_path %>